<template>
  <div
    class="cardBox h20 p2 mb3"
    :style="{ backgroundImage: `url(${bgUrl})` }"
    style="background-size: cover; background-position: center"
  >
    <div>
      <p >{{ boxContent?.title || '' }}</p>
      <p class="text-2xl font-medium">{{ boxContent?.number || 0 }}</p>
    </div>
    <div>
      <el-image :src="iconUrl" fit="fit" />
    </div>
  </div>
</template>

<script lang="ts" setup>
defineOptions({ name: 'PackageCard' });
import { defineProps, toRefs,computed } from 'vue';
import {getAssetsFile} from '@/utils/getAssetsFile'
const props = defineProps({
  boxContent: {
    type: Object
  }
});
const { boxContent } = toRefs(props);
const bgUrl = computed(() => {
 return getAssetsFile(props.boxContent.bgUrl)
});
const iconUrl = computed(() => {

 return getAssetsFile(props.boxContent.iconUrl)
});

// const boxContent = {
//   type: 'blue',
//   title: '本月新增设备',
//   number: '9000',
//   icon: 'Setting',
//   bgColor:'lightgreen'
// };
</script>

<style lang="scss" scoped>
.cardBox {
  // width: fit-content;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;

  div:first-child {
    color: #fff;
    line-height: 24px;
    margin-right: 20px;
  }

  div:last-child {
    background: #fff;
    border-radius: 10px;
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 45px;
    font-size: 20px;
  }
}
</style>
